package com.youdoneed.news.feign;

import com.youdoneed.base.application.RequestMessage;
import com.youdoneed.base.application.ResultMessage;
import com.youdoneed.news.model.CmfPostsDtlVo;
import com.youdoneed.news.model.CmfPostsListVo;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * 说明。
 *
 * @author Ewing
 * @date 2017/4/26
 */
@Component
public class NewsFallback implements NewsClient {

    @Override
    public ResultMessage<CmfPostsDtlVo> getPostsDtlById(Long postId) {
        return new ResultMessage<CmfPostsDtlVo>().toFailure(RequestMessage.getMessage("获取新闻失败！"));
    }

    @Override
    public ResultMessage<List<CmfPostsListVo>> getNewsForHomePage(Integer beforeDeadTime, Integer lastDeadtime, String userId) {
        return new ResultMessage<List<CmfPostsListVo>>().toFailure("首页获取热评新闻失败！");
    }

    @Override
    public ResultMessage<CmfPostsDtlVo> getJokesForHomePage(Date beforeDeadTime, Date lastDeadtime, String userId) {
        return new ResultMessage<CmfPostsDtlVo>().toFailure("首页获取趣闻推荐失败！");
    }

    @Override
    public ResultMessage<Integer> updateCommentCount(Long postsId, String updateType) {
        return new ResultMessage<Integer>().toFailure("更新新闻评论失败！");
    }

    @Override
    public ResultMessage<Integer> updatePostLikes(Long postsId, String likesType) {
        return new ResultMessage<Integer>().toFailure("更新新闻点赞数失败！");
    }

    @Override
    public ResultMessage<CmfPostsListVo> getPostsListById(Long postId) {
        return new ResultMessage<CmfPostsListVo>().toFailure("根据ID获取新闻列表失败！");
    }

    @Override
    public ResultMessage<List<CmfPostsListVo>> getNewsByIds(List<Long> ids) {
        return new ResultMessage<List<CmfPostsListVo>>().toFailure("通过id列表获取新闻列表失败！");
    }
}
